
window.onload = function(){
	document.getElementsByClassName("text")[0].onkeyup = function(){
		// length长度
		// this.value.length
		// this.innerHTML.length
		// value        值
		// innerHTML    里面的html
		
		var length = this.value.length;
		var kkp = document.getElementById("kkp");
		var kkb = document.getElementsByClassName("text")[0];
		
		if(length > 20){
			kkp.innerHTML = "20" + "/200";
			kkp.style.color = "red";
			// 文本禁用
			kkb.disabled = "true";
			
			alert("你的文本框已经不能用了,请刷新");
			
			
		}else{
			kkp.innerHTML = length + "/200";
			kkp.style.color = "black";
		}
		
	}
}